package com.glory.brepda.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.brepda.R;
import com.glory.brepda.entity.RepairLogEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_DateUtils;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

/**
 * FileName: RepairLogListAdapter
 * Author: XJH
 * Date: 2020/8/22 11:19
 * Description:
 * History:
 */
public class RepairLogListAdapter extends BaseQuickAdapter<RepairLogEntity, BaseViewHolder> {
    public RepairLogListAdapter(@Nullable List<RepairLogEntity> data) {
        super(R.layout.item_bin_info_list,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RepairLogEntity item) {
        helper.setText(R.id.list_tv1,String.valueOf(helper.getAdapterPosition() + 1));
        try {
            helper.setText(R.id.list_tv2, FreeApi_DateUtils.longToString(item.getTRANS_TIME(),"yyyy/MM/dd HH:mm:ss"));
        } catch (ParseException e) {
            e.printStackTrace();
            helper.setText(R.id.list_tv2,String.valueOf(item.getTRANS_TIME()));
        }
        helper.setText(R.id.list_tv3,item.getTRANS_TYPE());
        helper.setText(R.id.list_tv4,item.getUPDATED_BY());
        helper.setGone(R.id.list_tv4,true);
    }
}
